﻿using Caliburn.Micro;

namespace OPSYS_Schematic.UIInfrastructure
{
    /// <summary>
    /// A toolbar part for various implementations of <see cref="IToolBarPart"/>.
    /// </summary>
    public class ToolBarPart : PartBase, IToolBarPart, IObservableParent<IToolBarPart>
    {
        #region Constructor

        public ToolBarPart(string name)
            : base(name)
        {
        }

        #endregion

        private readonly IObservableCollection<IToolBarPart> items = new BindableCollection<IToolBarPart>();

        private bool _isSeparator;
        private string toolTip;

        #region IObservableParent<IToolBarPart> Members

        IObservableCollection<IToolBarPart> IObservableParent<IToolBarPart>.Items
        {
            get { return items; }
        }

        #endregion

        #region IToolBarPart Members

        public string ToolTip
        {
            get { return toolTip; }
            set
            {
                toolTip = value;
                NotifyOfPropertyChange(() => ToolTip);
            }
        }

        public bool IsSeparator
        {
            get { return _isSeparator; }
            protected set
            {
                _isSeparator = value;
                NotifyOfPropertyChange(() => IsSeparator);
            }
        }

        #endregion
    }

    public class ToolBarButton : PartBase, IToolBarPart
    {
        #region Constructor

        public ToolBarButton(string name)
            : base(name)
        {
        }

        #endregion

        private string toolTip;

        #region IToolBarPart Members

        public string ToolTip
        {
            get { return toolTip; }
            set
            {
                toolTip = value;
                NotifyOfPropertyChange(() => ToolTip);
            }
        }

        public bool IsSeparator
        {
            get { return false; }
        }

        #endregion
    }
}